home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-15
/
phbench.zip
/
BENCHFN.C
< prev
next >
Wrap
Text File
|
1993-01-04
|
813b
|
26 lines
/* benchfn - benchmark for function calls
* Thomas Plum, Plum Hall Inc, 609-927-3770
* Let T be the execution time in milliseconds
* Then average time per operator = T/major usec
* (Because the inner loop has exactly 1000 operations)
*/
#include <stdio.h>
int dummy = 0;
f2() { f3();f3();f3();f3();f3();f3();f3();f3();f3();f3();} /* 10 */
f1() { f2();f2();f2();f2();f2();f2();f2();f2();f2();f2();} /* 10 */
f0() { f1();f1();f1();f1();f1();f1();f1();f1();f1();} /* 9 */
main(ac, av)
int ac;
char *av[];
{
long d, major, atol();
major = atol(av[1]);
printf("executing %ld iterations\n", major);
for (d = 1; d <= major; ++d)
f0(); /* executes 1000 calls */
printf("dummy=%d\n", dummy);
}